package com.zxp.drools.controller;

import com.zxp.drools.model.DroolsRule;
import com.zxp.drools.repository.DroolsRuleRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author zxp
 * @date 2021-12-22 16:37
 */
@RestController
public class DroolsRuleController {

    @Autowired
    DroolsRuleRepository droolsRuleRepository;

    @PostMapping("/saveRule")
    public DroolsRule save(@RequestBody DroolsRule rule){
        return droolsRuleRepository.save(rule);
    }


    @GetMapping("/getRule")
    public DroolsRule save(Long id){
        return droolsRuleRepository.getOne(id);
    }

}
